#include "engine.h"
#include "gameentity.h"
#include "render/assimploader.h"
#include "render/rendersystem.h"
#include "input/input.h"
#include "Sound/dsutil.h"
#include "Sound/soundentity.h"

DEFINE_ENTITY(gameentity_t,model_t)
PROPERTY_BINDING_BEGIN(gameentity_t)
	BIND_PROPERTY(gameentity_t,posscale,float3);
	BIND_PROPERTY(gameentity_t,zoffset,float);
PROPERTY_BINDING_END

gameentity_t::gameentity_t()
{
	posscale.set(20,20,20);
	zoffset=60;
}

void gameentity_t::onload()
{
	model_t::onload();
}

void gameentity_t::init()
{
	model_t::init();
}
void gameentity_t::update()
{
	model_t::update();
}

void gameentity_t::render()
{
	model_t::render();
}

gameentity_t::~gameentity_t()
{
}

void gameentity_t::exit()
{
	model_t::exit();
}





struct leocamera_t:entity_t
{
	DECLARE_ENTITY;
	leocamera_t();
	void init();
	void update();
	void render();

	//props
	float speed;
	float rotspeed;
};


DEFINE_ENTITY(leocamera_t,entity_t);
PROPERTY_BINDING_BEGIN(leocamera_t)
	BIND_PROPERTY(leocamera_t,speed,float);
PROPERTY_BINDING_END

leocamera_t::leocamera_t()
{
	speed=10;
}

void leocamera_t::init()
{
	entity_t::init();
}

void leocamera_t::update()
{
	entity_t::update();
/*
	float4x4 mtx=getworldmtx();
	if (INPSYS->keyboard.key_down(DIK_UP))
		mtx.translate()+=speed/60*mtx.axis(2);
	if (INPSYS->keyboard.key_down(DIK_DOWN))
		mtx.translate()-=speed/60*mtx.axis(2);

	if (INPSYS->keyboard.key_down(DIK_LEFT))
		mtx.translate()-=speed/60*mtx.axis(0);
	if (INPSYS->keyboard.key_down(DIK_RIGHT))
		mtx.translate()+=speed/60*mtx.axis(0);

	setworldmtx(mtx);

	LPDIRECTSOUND3DLISTENER listener;
	SOUNDMAN->Get3DListenerInterface(&listener);
*/
//	listener->SetAllParameters()
}

void leocamera_t::render()
{
	RSYS->global_shader_data.camera_mtx=getworldmtx();
}